<template>
  <div class="main">
    <c-form :formList="formList" @searchTable="searchTable1"></c-form>
    <s-table
      :columns="columns"
      :tableData="tableData"
      :getDataWay="getDataWay"
      @getTableListData="getTableListData1"
      v-bind="$attrs"
      ref="stable"
    >
      <template #group="scope">
        <slot name="operation" v-bind="scope"></slot>
        <!-- <slot name="operation" :row="scope.row" :$index="scope.$index"></slot> -->
      </template>
    </s-table>
  </div>
</template>

<script setup lang="ts">
const emit = defineEmits(["getTableListData"]);
import STable from "../Table/index.vue";
import CForm from "../CForm/index.vue";
const stable = ref();
const props = defineProps({
  formList: {
    default: [],
    type: Array,
  },
  columns: {
    default: [],
    type: Array,
  },
  tableData: {
    default: [],
    type: Array,
  },
  // 是否能多选
  // selection: {
  //   default: false,
  //   type: Boolean,
  // },
  // // 是否有序号
  // index: {
  //   default: false,
  //   type: Boolean,
  // },
  // el-table添加row-key
  getRowKey: {
    default: function () {},
    type: Function,
  },
  getDataWay: {
    default: {},
    type: Object,
  },
  pagination: {
    // pageNum,pageSize必传
    default: {},
    type: Object,
  },
});

const searchTable1 = (data: any) => {
  console.log(data);
  stable.value.loadData(data);
};
const getTableListData1 = (data: any) => {
  emit("getTableListData", data);
};
</script>

<style scoped lang="scss">
.main {
  height: 100%;
  display: flex;
  flex-direction: column;
}
</style>
